﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BitPortal.Business
{
    public static partial class ExceptionHander
    {
        public static void ThrowObjectNotFoundException()
        {
            HttpContext.Current.Response.Redirect("~/Message.aspx?m=Message.ObjectNotFound"); 
            HttpContext.Current.Response.End();
        }

        public static void ThrowAdminLoginRequireException(string returnUrl = null)
        {
            if (returnUrl != null)
            {
                HttpContext.Current.Response.Redirect("~/Admin/Login.aspx?r=" + returnUrl);
            }
            else
            {
                HttpContext.Current.Response.Redirect("~/Admin/Login.aspx");
            }
            HttpContext.Current.Response.End();
        }

        public static void ThrowNotPermissionException()
        {
            HttpContext.Current.Response.Redirect("~/Message.aspx?m=Message.NotPermission");
            HttpContext.Current.Response.End();
        }

    }
}